﻿using UnityEngine;
using System.Collections;

public class RigibodyMove : MonoBehaviour {

	private Rigidbody m_Rigibody;
	private Transform m_Transform;
	// Use this for initialization
	void Start () {
		m_Rigibody = gameObject.GetComponent <Rigidbody>();
		m_Transform = gameObject.GetComponent<Transform> ();
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKey (KeyCode.W)) {
			m_Rigibody.MovePosition (m_Transform.position + Vector3.forward*0.5f);
		}

		if (Input.GetKey (KeyCode.S)) {
			m_Rigibody.MovePosition (m_Transform.position + Vector3.back*0.5f);
		}


		if (Input.GetKey(KeyCode.A)) {
			m_Rigibody.MovePosition (m_Transform.position + Vector3.left*0.5f);			
		}


		if (Input.GetKey (KeyCode.D)) {
			m_Rigibody.MovePosition (m_Transform.position + Vector3.right*0.5f);
		}
	}


}
